package com.wx.web.controller.catagroy;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.eachonline.core.JsonResult;
import com.eachonline.util.StringUtil;
import com.wx.business.course.IxbCourseCategoryService;
import com.wx.model.IxbCourseCatagroy;
import com.wx.model.IxbCourseCatagroyExample;

/**
 * 类目控制器
 *
 * @author wemo
 * @Date 2018-08-08 18:27:50
 */
@Controller
@RequestMapping("/categroy")
public class CourseCategroyController {
	
	 @Autowired
     public  IxbCourseCategoryService ixbCourseCategoryService;
	 
	 
     /**
      * 我的课程类目
      * @param sid
      * @return
      */
    @RequestMapping(value = "/list")
    @ResponseBody
    public JsonResult categoryList(HttpServletRequest request ,String parentCode) {
		
    	if(StringUtil.isEmpty(parentCode))
    	{
    		parentCode="000";
    	}
    	IxbCourseCatagroyExample ext=new IxbCourseCatagroyExample();
		ext.createCriteria().andParentCodeEqualTo(parentCode);
		List<IxbCourseCatagroy> categoryList=ixbCourseCategoryService.selectByExample(ext);
        Map<String,Object> result=new HashMap<String,Object>();
        result.put("courseList", categoryList);
		return new JsonResult(true,result);
    
    }
    
    
   
    
}
